package org.example.config;

/**
 * @BelongsProject: Dynamic-relationship-binding
 * @BelongsPackage: org.example.config
 * @Author: dengxiyan
 * @CreateTime: 2025/07/04  10:53
 * @Description: 关系配置加载器
 * @Version: 1.0
 */
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "dynamic-relations")
public class RelationConfig {
    private List<RelationDefinition> config;

    @Data
    public static class RelationDefinition {
        private String source;
        private String target;
        private String type; // ONE_TO_MANY, MANY_TO_ONE, MANY_TO_MANY
        private String sourceField;
        private String targetField;
        private String joinTable; // 仅对MANY_TO_MANY有效
    }
}
